package com.roy.kafka.trident;

import org.apache.storm.Config;
import org.apache.storm.security.auth.SimpleTransportPlugin;
import org.apache.storm.thrift.TException;
import org.apache.storm.thrift.transport.TTransportException;
import org.apache.storm.utils.DRPCClient;
import org.apache.storm.utils.Utils;

import java.util.concurrent.TimeUnit;

public class DrpcClient {

    public static void main(String[] args) throws TException {
//        final LocalSubmitter localSubmitter = LocalSubmitter.newInstance();
//        localSubmitter.printResults(15, 1, TimeUnit.SECONDS);
//        Config conf = new Config();
        //NOTE 要设置Config.DRPC_THRIFT_TRANSPORT_PLUGIN属性，不然client直接跑空指针
//        conf.put(Config.DRPC_THRIFT_TRANSPORT_PLUGIN, SimpleTransportPlugin.class.getName());
//        conf.put(Config.STORM_NIMBUS_RETRY_TIMES,3);
//        conf.put(Config.STORM_NIMBUS_RETRY_INTERVAL,10000);
//        conf.put(Config.STORM_NIMBUS_RETRY_INTERVAL_CEILING,10000);
        DRPCClient client = new DRPCClient(Utils.readDefaultConfig(),"172.16.48.10",3772);
        System.out.println(client.execute("words","a b c"));
    }
}
